library(xtable)
library(arm)
library(Matrix)
library(MASS)
library(Rcpp)
library(lme4)
library(foreign)
library(stargazer)
library(nnet)
library(lmtest)
library(TMB)
library(effects)
library(sjPlot)
library(sjmisc)
library(sjlabelled)


data = read.dta("/Users/jktboston/Dropbox/_1Dissertation/Chapter1_TYP/Boston_JLC_replication_apr2019.dta")

complexity <-data$complexity 
SEdist <-data$SEdist 
neg_treatment <-data$neg_treatment 
negative_SEdist <-data$negative_SEdist 
PEdist <-data$PEdist 
PSdist <-data$PSdist 
negative_PEdist <-data$negative_PEdist 
negative_PSdist<-data$negative_PSdist
us<-data$us
casenum<-data$casenum


ols_model_basic <- lm(complexity ~ SEdist +
                        neg_treatment + negative_SEdist)
summary(ols_model_basic)
AIC(ols_model_basic)
BIC(ols_model_basic)

lmer_model_basic <- lmer(complexity ~ SEdist + 
                           neg_treatment + negative_SEdist +
                           (1|casenum))
summary(lmer_model_basic)
AIC(lmer_model_basic)
BIC(lmer_model_basic)

ols_model_big <- lm(complexity ~ SEdist +
                        neg_treatment + negative_SEdist +
                        PEdist + PSdist + negative_PEdist + negative_PSdist)
summary(ols_model_big)
AIC(ols_model_big)
BIC(ols_model_big)


lmer_model_big <- lmer(complexity ~ SEdist + 
                           neg_treatment + negative_SEdist +
                           PEdist + PSdist + negative_PEdist + negative_PSdist +
                           (1|casenum))
summary(lmer_model_big)
AIC(lmer_model_big)
BIC(lmer_model_big)


